<?php

use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateTableUsersClubs extends Migration
{

    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        //
        if (!Schema::hasTable('users_clubs')) {
            Schema::create('users_clubs', function (Blueprint $table) {
                $table->increments('id');
                $table->bigInteger('user_id');
                $table->bigInteger('club_id');
                $table->text('permissions');
                $table->index(array('user_id', 'club_id'));
            });
        }
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        //
    }

}
